﻿Public Class DuTinhTuongLaiForm
    Dim tbthu As Double
    Dim tbchi As Double    
    Private Sub DuTinhTuongLaiForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        tbchi = QuanLyChiBUS.TrungBinh(MainForm.current_user.MaUser)
        tbthu = QuanLyThuBUS.TrungBinh(MainForm.current_user.MaUser)
        txtTBChi.Text = tbchi
        txtTBThu.Text = tbthu
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        If txtSoTien.Text.Trim().Length > 0 Or IsNumeric(txtSoTien.Text) Then
            Dim sotien As Double = Double.Parse(txtSoTien.Text)            
            If cbTinhCaChi.Checked Then
                sotien = Math.Round(sotien / tbthu, 2)
                lbTinh.Text = sotien.ToString()
            Else
                sotien = Math.Round(sotien / (tbthu - tbchi), 2)
                lbTinh.Text = sotien.ToString()
            End If
        Else
            MessageBox.Show("Vui lòng điền vào số tiền mong muốn")
        End If
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Me.Dispose()
    End Sub
End Class